Handle errors a bit more gracefully and added more tests #1