Refactored existing classes and added an offset cache.