Simpler version that scans directly into a file