Finished proj2b!

Implemented do_bgfg(), with error handling (not elegant, but works).