refactoring for update #1
refactoring for update #2
update seems to work now