more tests and improvements