refactor Scanner a bit (#135)