stateful scanner