Reformatted for PEP 8

There were some mistakes in the formatting for PEP 8
Added comments

Added more comments to the code