Listen and respond to both mouse and touch events
Improve formatting slightly