Changed slider code structure