Added return type specializers for scan.
Better error reporting.