Updated code in response to Tim's Review.