modified g, got rid of hard dependency on start=y0 or stop=y(n+1)