UpdateSlider function + add some global vars