Copy nikki's drag function