added multi-threading for multiple gamepads