Rewrote tests to make them more useful and robust