adds driver code and each_with_index method