Complete the sign in and sign out function