Moved some code for entities
Improved hacks