completed refactoring of vreduce based on codegen