Added try/catch to testing the code