try slightly more complicated version of getNextResult