Many new tests and a few fixes resulting from the expected results of those tests