updated checking of user input