Addressing Issue #51 & Issue #52

1. Adds attributes to non-leaf elements.
2. Elements with the same name will now be in a proper numerically indexed array rather than having the first element having its child elements as non-numeric keys.
Well spotted; updated to fix.

Thanks!