refactoring of the multiple touch handling