Refactor drag and drop