fixes race condition on sparse matrix
parallelizes submatrix construction
small identation fixes
improves comment content