Add a highly complex function

To be spotted by Sonar