Add touch support, cleanup the javascript a bit