better data structure for entities.js