Use the offset map table instead of searching for magic bytes

This provides a moderate performance improvement.