Moved computation of interacting sides sequence out of monomial loop.