Abstract out the run server part.