Type checking

Adding explicit checks and tests that the iterable and iterator are the proper types.