Major refactoring, converted invitations to notifications and fixed schema.