fixed main design patterns for server.