refactoring mem-mapped-files