add tests; minor changes