Templates: separating layout from logic