Modifying matrix