Minor refactoring
Strengthen auth/de-auth logic with UI support