More refactoring around input validation.
Merge pull request #1131 from jmaas/master

More refactoring around input validation.