wrap entire js in executing anonymous function to take variables out of global scope