cache support and template improvement