Added try/catch blocks to help with errors.