refactored my_each method, added my_each_with_index method