Adjust matrix