Successfully implemented matR into main.