added simple template system.