changed some ints to size_t