Upgrade

Reorg packages, refactor entities handling, improve performance