Refactor client code
Merge pull request #39 from thejsj/master

Refactor client code