Some code simplifications/optimizations.