cleaned up initSlider code