adding simple input validation with tests