linked entity and modal system refactoring