Check for AUTH_ERROR and small code cleanup
Version 0.2