UPD: Changed plenty of things to try to match Sonar's rules.