refactored and fleshed out the handler and clients