Changes due to code review from @dsaff.