Updated the sliding functionality