helper.py refactoring