Made changes also to the random inertia algo