Updated code based on code review feedback.