Restructure slider's logic