mmap file code cleaned