rewrote and fixed drag