Move more stuff to log file.
refactor stuff into authenticatedClient function.