script to process BG subjects.