Modified code and comments