Added some structure for the authentication class, and the handling of the result.