make code more compact - but I find 'isDragging' clearer so I didn't factor it out as JS did in episode 61