extract touch logic
add test for touch logic