final implementation of draggable