Refactoring

Some refactoring in client.rb