Added gesture detection. Various tinkering.