Removed exception handling code that was being used instead of if loop.