Cleanup, mostly based on Sonar analysis