Added some simple input validation on parameters