started implementation of file cleanup procedure: STILL TO BE FIXED!