clean up the logic to handle invites so much