Merge pull request #1131 from jmaas/master

More refactoring around input validation.