Clean up code warnings and checkstyle errors