general improvements on authentication