template and DB update