Handle multiple modules mixed into another module

Looks like my patch in #276 only handled part of the module inclusion issues. 

This one handles the case where:
- you have modules `A`, `B`, `C`, and class `X`
- `C` includes both `A` and `B`, and may also have attributes of its own
- `X` includes `C`

Currently, some attributes would get lost depending on what order the `includes` happened in (see the unit tests).