Namespacing standalone JS functions and removing one unused
Namespacing common functions properly.