Integrate code review feedback from @fpotter