restructured client code