An adaptive approach to stepsize control in ODE solvers