Changed how sparse matrices are efficiently created