started to add some input validation checks