Rewrite jquery plugin using $.widget