Refactor code to call 'client' once at user initialization.