Update to logging and debug. Some cleanup