Improved filtering in the gk_condition function.