Add security checks and add code comments.
Revert "Add security checks and add code comments."

This reverts commit 6162c5e335ff5d1ae55ab0dd9bd9ce20806fce53.
Add security checks and add code comments. bugid:80850