Replaced debug print statements with logger.debug