Added comment and revisions to prevent memory leak