Server and controller refactored