Made function to determine speed and removed print