Added tests to ParllelIteratorTest and refactor.