server refactoring
to work