removed duplicated code, made the code pep8 compliant