Minor code refactor from last PR.