started some input validation code and unit tests for it