added sparsity option in the begin