changed indexing of yvector and clamping of model cell outside of derivative function. Learn how to deal with discontinuities