changed value types for indexes to size_t