Added calls to more upgrade APIs in stress test
Improved error handling in stress test
Added more tests
Simplified manipulating lock state
Moved nested class into new file