Replaced many int's with unsigneds because std::vector.size() returns unsigned.