Cleaned up template rendering