Tidy up python script