Updated code after review.