rewrote jquery invocation code