Handle invalid authentication, style cleanup, minor fixes