Edit Python script to increase readability