Work with matrix