Scanner refactor