Fixed duplicate row, and made matrix script ready for testing