singletons and srver refactor