Optimization

According to the comments of the TA's
And code formatted according to PEP8