Major code cleaning, mostly cosmetic