refactor: invite broken out in to lib/, with revised nice tests