Added rescue for errors and removed puts