more tests and some related code