Better rules algorithm