server refactoring
server fixes