Add tests for reference position and fix refpos position off-by-one-error
Merge pull request #40 from arahuja/referenceend

Fixing reference position from offset implementation