refactored update()