Tested refactored functionality. Removed logging.