beginn to rewrite js