change to python script, speed up