incorporated suggestions from code review.