basic generic load order algo to be used in module loading