Restructure entity system and update for dt