Issue #29: Overhaul database to use ManyToMany where appropriate.