cleanup and logging work