pep8 correction and bugs are fixed