Changing collections to be objects instead of arrays 

This is related to what was discussed in assemble/assemble#216

I am kinda new to github, so I did not know a better way to do this pull request than this. Please tell me if there's a way to link pull requests better to issues than what I've done here.

Futhermore, all of these changes are just guesswork. I'd really like if you guys could check this code with care, so that no bugs will creep in and all the cases have been considered.

Thanks.