Move sonar code to own file