Extracted redirectUnauthorized() and changed a name/fixed indenting.