Base functions for templates rev 2