simplify scanning routine
fix another scanning bug
add repl commands