Refactored to make it easier to check the order of imports without actually
generating a new ordering.

Also added some failing unit tests.