refactor modules.py