Split client code and API code into two modules.
Added usage examples.