Perfect slide code left-to-right, bug when going right-to-left