Refactor based on feedback on c41016d. Ref. #1120.