Fixes problem with writing the correct entries in the matrices. This was causing crashes as invalid memory was being written to.
Adds documentation to the iterator header.