refactors a client api out of bin tool for use in other programs