Replacing printf with std::cout to avoid compiler warnings
Refactoring: renaming functions, no functional changes
Using madvice to free mapped pages