Incorrect offset calculation corrected.
Simple but failed test added (now passes).
Test with sequence of operations added. TODO: More tests.