Tweaked python script