Added logic to 'sign in'/'sign out'