Refactored code. Removed a logging call.