added tests and a bunch of questions from the code review