Creating a generic iterator creator