Some small cleanups.
Some small optimizations.
Some small cleanups.
Revert "Use elfif's instead of case statements."

This reverts commit 758a14672f4dee7f0636189a9be7b03144365976.
Merge branch 'optimizations'