adding variables for length and speed