move cursor fns
add imports
fix withstream
add index