General purpose template engine