Improved auth process, improved error handling