Cleaned up and improved test coverage
Tweak to ensure order is always the same between python versions