add conditions to prevent undesired gesture from being removed