refactoring of both semantic_space_builder and mp module