Updated to work with speed also