updating to use internal cursor