Refactoring to capture more duplicated code.