added more logging, and cleaned up commented out code