better previous sliding
advanced previous logic