Improve scanner, makes it work and enable to read file