rewriting JS