updated drag & drop function