TimHanson's gtkclient code, modififed to work with BMI