dnd example :: js refactoring