Moved function into client.