refactored GallerySlider code