Converted velocity functions to use arrays.