added better death handling