Trying to get functions to work in templates
status: logic error remains