Final script to capture gestures