Algorithm things refactored and the next/previous button now working
properly.