Further refactor in response to code review feedback.