do {
shuffled = false;
for ( AcrossModule module : source ) {
AcrossModuleRole role = getModuleRole( module );
if ( role != AcrossModuleRole.INFRASTRUCTURE && role != AcrossModuleRole.POSTPROCESSOR ) {
Collection<AcrossModule> optionalModules = getAppliedOptionalDependencies( module );
for ( AcrossModule optional : optionalModules ) {
if ( moveToIndexIfPossible( orderedModules, optional, orderedModules.indexOf( module ) ) ) {