replaced shell script with better python script