refactored swipe left and swipe right to a single function