Reworked Authentication for more flexibility.