Improved comments and formatting.
Drag offset is now passed explicitly to the dragging callback so that the user can choose what to do with it.