Reorganized the drag and drop code.