Authentication changes

I'm making some changes around authentication. Also a TODO about exception handling