An off-by-n bug; wasn't calculating with the offset of the previous case.