Vector function code