Fixed non-termination bug, still includes logging
Removed debug logging.