Refactored client to use the module pattern