Changed do_bgfg method. Fixes #18. Fixes #19.