Optimized the reasoning engine