Include ri
Fix iteration no.
Fix pruneMatrix
Print progress