Added BGTools.py