Made operation order in velocity calculation more explicit