Cleaned up and renamed retabling.py