global variables, moved jQuery functions outside of link function.