improved update code.
Merge branch 'test' into dev