Rename factory->middleware