Updated with a lot more tests.