refactor gesture if cascade