Change dragging algorithm. Still buggy.