Refactor try/catch blocks... better handling of errors.