much better tests and code