fix tests and add comments