moved to sparse matrices