done most of R-K algo