Broke up client into several functions.