Complete server refactor