db reset and some refactoring in 9781783287031