first pass at V2

This cleans up a lot of code and gets rid of the `parents` key (replaced
by a hash of parents, and parent properties). Still lacking
dirty-checking and caching.