added a lot of input error checking