Changed the number of dynamic chunks to be a function of loop size.