Fixes for some sonar issues

And fixes #3