fixed comparing with '==' to True and added minor PEP8 edits.