more minor fixes and refactoring with death