Refactoring function to keep uniform.