Cleaned up code and commented nicely. Added a constant that sets the matrix size.