move helper functions to utils.py and pep8