rewritten rebadylize() without DOM manipulations, added events