Error checking

Made sure shoddy user input won't break everything.