Complete speed function