Cleaned up matrix enlarge code a bit, and added some comments.