Fixed touch input (the right way)
clean up code