Changed int to size_t for index.