server: big modification of code