Fixed markClean handling and better prev. file code