started refactoring the swipe code