code refactor to support touch events.