Move more functionality into common.py