getting function calling to work in templates