Added try/catch statements.