Added validations of inputs