Check for equals when searching for prev as well as next
Reverting previous change - issue is with integer division
Leftover print debug code