load all data up front

cleaned up a bunch of stuff
load all data up front
use ItemGUID
fix a bug in BG queries
fix a bug in get next BG function index out of bounds