Added logic for drag events