Rework delete_instance