Improve the authentication mechanism, put it into it's own class.