move onSlide for better readability