port client code to trunk
port client code to trunk