Simple gedture detection code.