replace extra python code & inprove js code