Refactored the entity hierarchy and texture stuff.