Rewrite using jquery and jquery-console