refining the way the ids matrix is handled.