added comments to global functions js