updated code surrounding related entities