Moved the authentication checking logic from the module to a class