refactor common.py