Update bg.h

Add some docstrings.