removing unused imports, using get_next_data() instead of _with_index