Updated according to code review feedback.