fix next/prev test
typecheck key
refactor fallout