Refactored template rendering with annotations