Moved function definition out of template.