moved createServer() function