code cleanup; undead moved to templates