[#981] Declare auth function
[#981] Clean up