You're not concerned about the sum of the major diagonal?

I don't understand the purpose for the variable 'last'. Can you describe what that does? Oh yeah, that reminds me: comments in your code...