Adapted the code for the new client code format.