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