Implementation of util methods that calculate offsets and count for positions and extents

This is the next step to solve issue #84