Refactor setSliderPosition