Clean up the matrix routines, replacing some of the intermediate pointers.
Clean up whitespace in main.