! removed unused globals since we moved the querys to subs