some unit tests; a bit cleanup