rewrite without jQuery