Refactored Runge-Kutta method