Extracted out subregion -> unit representation into helpers.py.
Changed the last of the old string formatting to new-style.
Use the underlying X_id field for foreign keys, where it makes sense to do so.