more functional python script