Refactor, proper dragging, using JQueryUI magic