Refactored nested associations so they are more readable.

I've moved some methods around in nested associations because the code is currently pretty hard to follow. 

There have lately been a couple bugs related to nested associations, so hopefully some refactoring will help out whoever stumbles upon the code. Additionally, I've added a some comments that hopefully make it more clear about what's going on.