Get rid of some deprecated method calls and fix some quality flaws