Fix the logic in line 32 so that the pos is not offset by 1 when two sides are equal.
Add the failing test case back to main funciton.