Added some validation checks