Restructured JS file to be in=line with other plugins