Almost finished refactoring for multiple server sessions