Changed the entity toArray method a bit