nested join chaining in hasAndBelongsToMany rels

Here's an attempt. It is working for me. 

Most of the changes are just my reformatting the functions so I could see what was going on. The main bit of getJoin() I pulled from the hasMany query.