modified main and matrix files