refactors rules, replaces alerts with text