Updated to support files of arbitrary size (assuming they can be mmaped)