Re-factor hash checking into separate function
Further simplify io.go