Various small code cleanups and optimizations. (Lazily evaluate conditionals)