source code for input module (gesture recognition)