rewriting on jQuery