Modularized ve a bit more and made permutation loop on subjects