Refactoring, tests and fixes

* TOKWITHME_DEBUG env var
* Api tests
* Separated Api and Client
* Synced client submodule