Editing catch statement, and a bit of refactoring