add tests, minor changes