Add support for nested objects. Closes #1.