tweaked: mmapping the file now works inside a function, passed from main.