Made a couple tweaks. Added get_nextoffset function to abstract getting next file offset.