Wrote some comments, and altered function heads to use Vec instead of generic vector<> where applicable