move functions to common.py