Improving optimisation and implementing CD4 calculations