Added code to handle touch events but there is still some bug fixes needed