Added some small error checking along with repl