cleaning up python script a little