Some refactor, membership management, delegation loops detection, more tests.