updated code for swipe