switch from eval to Function, fix some pep8 issues