code cleanup, template tweak