Server side refactoring (no new functionalities added). Moving stuff around, extract some new types, adjust namespaces, etc.