Get ev and nv to a more working state

Still need one more condition and some optimization
Finish iFunction
Finish dFunction