Refactoring of the client context