MASSIVE refactoring of client class