Factor out mvagent() from rewire()