User authentication error handling and some simplifications.