refactored update