Major reorganization of how the moment matrix is generated