Code refactored; dragging working.