Sorted out more of the authentication stuff