Changed vec to rowvec for easier filewriting.