implemented more flexible iterator hook API