Moving createServer code into a method.