main loop and touch handling added