Refactors swipe and click functions