Added advanced debug mode for easier issue tracing.
Fixed issues in optional authentication. I've refactored the authentication to use "AuthenticationProfile"s. This object contains a cached layer of the authentication settings to prevent issues and miss configuration.