Minor. Refactored one function that I has forgotten about