Modified code to run stochastic or difference equations version