Added some logic for drag drop