Finished up matrix calculations