And more ai refactoring to please sonar :)