Add authentication handling (and clean up end-of-line whitespace)