took away the global variables, and conformed to JS var naming standards