The >=, checking whether a module index was in already in the module-by-index list, needed to be strict. Also, fold nested ifs into one and fix some bad spacing.