reorganize the entities