topo sort modules

Topo Sort the modules before we starting factoring to ensure that we handle parents before we start handling dependencies.