Fixed links. Optimized and finished finding rules in database.