Updated code to use new vectors (untested)