Apply some changes suggested by IntelliJ, reformat code in a few places