Minor code simplifications and tidy-ups.