Refactor protocols and clientfactories to be class variables.