Use has_many_through rather than has_and_belongs_to_many, assorted related fixes