pseudocode for what bwmg will need.