Fix checkstyle violations and deprecated method