re-order part of code to avoid MVMROOTs