Move touch detection to app and correctly loop over touches.