prototypal implementation (with scanner)