Refactored to make draggable directive more generalizable