add tests and comments