initial work based on a patch by dominik, refs #1022