rough implementation of iterator