added Entity getId, made some friends.
no more entity references and fixed entity active count.
uncommitted changes