Cleanup update() algorithm