WIP on #3, all the gesture detection stuff.