implemented iterator and wrote a few tests