general iteration improving the API