Refactored clients

Refactored clients.
Added branch restriction tests.
Added HTTP tracing.