Refactored to remove try/catch blocks