Implement gesture detection