Clean up the drag and drop code a bit.