Validates user input