Writing car vector function