Refactor the draggable feature