added nextByStep and previousByStep to utils and refactors to use it