Some basic error checking around input