make dependency matrix more efficient