reorganize and clean up entity usage
more entity logic cleanup