more logging and cleanup