incorporate scan and fix the stylistic suggestions