cleaned up code in test_update