Proper error handling, added QUIT command