Changed an int to string::size_type, also used .size() instead of .length()