rewrite of slider logic for stability