refactor drag and drop, add code documentation