Protect global scope and add some comments