more python-style refactoring