clean up pep8 error and silly code redundancy