PR for code review.

May want to put all this code in the try block since it doesn't make sense out of that scope.