enhanced sign in / sign out logic