Refactored to match the server code changes