Performance Improvements

Re-organized if statements and chunks of code resulting in about 10%
faster compilation time of stylesheets with heavy use.