A whole lot of nighttime hacking plus the mother of all database updates. Includes script that holds the basic algortithm as a management command plus models to support.
Fixing merge conflicts