tidying client code