Improved swipe detection
Added clear function