Refactoring. pep8 checked. pyflakes cheked.