refactor getCurrentAndNext