This is SF Feature Request #3310695. I made some changes to the original patch from Benedikt Schirrmeister.