updating templates, improving item update code