Refactor invitations
Fix failing tests