Update Plugin function scope

Old scope was on window, which was a bad idea.