Modified code in response to review