Updated for compatability with newest jquery