Tidy up and apply PEP8 guidelines.