Starting to refractor drag.js to eliminate globals as much as possible.