Added the entity for the join table, modified calculations.