Further improvement to handle dragging code.