move to a client struct for simplified processing and for easier testing (to come)