Slight bugfixes and MOAR TESTS!!1!