modified py script and cleaned up my own version of JS