changed to more elegant scope-passing for readFile callback