cleaned up logic around clean up processing and file map