More common functions for the scanner.