moved drag and drop code