Enable momentum scrolling on touch devices
Restructure JS code