cleanups
add rindex to query