Added priority and state filtering