integrate the read-in and vg code, fixing a few bugs that become apparent with integration