Base functions for templates rev 3