added sanity checks to user inputs