modified matrix and main files