Finish drag and drop function