Code conformant with PEP8.
Added commenting.
Code refactorization.