Fixed typo, renamed variables, some pep8 fixes
Fix failing tests