add names to events for easier debugging
move template_env from module to application