Created a proper client & some refactoring