ch 11 excercises. stats test for users. some refactoring