Smoothed out code, PEP8 compliance