added flushes and startServer method