refactored client and authorization to separate classes