More work on input validation.
Merge pull request #1181 from jmaas/master

More work on input validation.