cleaned up color map algorithm so that it doesn't loop through all entities twice