Pass in function to for template