Added try-catch wrapper.