implemented priority for rules