Refactored out a function.