cleaning up ux prev next button code