add accelerateToSpeed function