some cleanup of CNN code