Added catch-all error catching