What is a substantial contribution to software design, with respect to authorship? Background

I am a biologist. I wrote and am about to submit a manuscript that describes a statistical analysis of computer model; it is a statistical methods and modeling paper.

After my manuscript was written, a collaborator with a background in CS started to develop the code for their own project. In the process, they substantially improved the code, making it more logical, more readable, more adaptable. However, it still reproduces my original analysis unchanged and the manuscript itself has not changed.

The collaborator has not asked for, and I have not offered, authorship, but another co-author asked me to consider it.

I am uncertain about whether his contributions merit authorship, and my primary concern is that authorship reflects intellectual contribution.  On the one hand, the manuscript itself has not changed. On the other, the software that was described by and will be released with the paper has changed. 

I would like to collaborate with this and other computer scientists more in the future, but I would like to better appreciate what constitutes an intellectual contribution.

Question

Both with respect to this case, and more generally, how can I determine when a collaborator's contribution meet both of the two following criteria of authorship (from the Committee on publication ethics):


substantial contribution to conception and design, or acquisition of data, or analysis and interpretation of data;
drafting the article or revising it critically for important intellectual content;


?

update: it is clear from further consideration and the answers in below that the contribution justifies authorship, so I will offer it.
My view on this particular case is that the CS colleague's name should not go on the paper for the simple reason that the research had been done and written up before his/her contribution was made. The CS colleague's work made no contribution to your results.

As you said, the CS colleague is going to use the code for his/her own research, so he/she already has something for free. One question you could be asking is whether you should be on his/her subsequent papers based on this software.

In general, people who do the development work do deserve some credit even if their work helps facilitate scientific output, rather than directly contributes to it. For example, if someone wrote a program based on some design that I made, which would then form the basis of my further work, I would definitely give them credit for it, at least on the first instance. 

Of course a lot of factors will influence this decision. Whether the developer is a PhD student, post-doc, professor or a "just a" programmer. Whether the person depends crucially on the publication. Whether the project's evaluation depends on joint publications (to show, for example, interdisciplinary collaboration). Political reasons: will the joint publication create goodwill for future collaborations?

It's not a black/white issue and very hard to decide. In general, it's probably best to avoid any possible badwill, because that can really spoil a (possible) collaboration.