Refactor client code #t4f