Used Sonar to fix a lot of bugs and flaws.