improvements for testing; some tests