reorganized python script so it made sense