implemented 'add' function
added error handling to repl