Many small changes for authentication. No logout yet.