adding pread64 and some other refactoring