use resolve_template instead of manual splitting