Minor efficiency refactoring
Minor efficiency refactoring