Beginning of server refactoring; cleaned up dependencies