average update, code refine(redundant code)