Feature/server refactoring

Implements #99