Generalized code for Load to use io.Reader