Cleaned up common.py code