refactored code from bh to gb