Fix #646
Fix #647
Formatting
First working implementation of #649
Added support to sub-packages for entities