Various code clean-ups

Due to their nature, it might be easier to review the commits individually.