Fixes accessing uninitialised memory in the IntMatrix.submatrix method
Cleans up the code and fixes some function calls which didn't take reference when they could.