Minor changes for slight performance increase.
Minor refactoring