function nextState = GB_step_template(state,input,noise,param)


%Soma
minfs = 1/(1+exp((-stateVS-40)/KNaSM));
ninfs = 1/(1+exp((-stateVS-40)/KKSN));

ionicCurrentS = gNaS*minfs^2*(1-stateNS)*(ENaS-stateVS)...
             + gKS*stateNS^2*(EKS - stateVS)...
             + 2.5*(stateVD-stateVS)...
             + gLS * (ELS - stateVS);


%Dendrite
minfd = 1/(1+exp((-stateVD-40)/KNaDM));
hinfd = 1/(1+exp((-stateVD-52)/KNaDH));
ninfd = 1/(1+exp((-stateVD-40)/KKDN));
pinfd = 1/(1+exp((-stateVD-65)/KKDP));

ionicCurrentD = gNaD * minfd^2*stateHD*(ENaD - stateVD)...
             + gKD*stateND^2*statePD*(EKD-stateVD)...
             + (1/.6)*(stateVS-stateVD)...
             + gLD*(ELD-stateVD);

nextState = [stateVS + oneDT.*(injectedCurrent + ionicCurrentS) ...
             + sqrtDT*PNoiseLevel*PNoise; ...
             stateNS + oneDT*((ninfs - stateNS)./TS); ...
             stateVD + oneDT.*ionicCurrentD; ...
             stateND + oneDT*((ninfd - stateND)./TND); ...
             stateHD + oneDT*((hinfd - stateHD)./THD); ...
             statePD + oneDT*((pinfd - statePD)./TPD)];

