Fix negative offset bug and add appropriate tests. (WIP)
Add more tests in preparation for a grand redesign.