Move local server init out of loop