Added more input validationn