some small bugs and enhancements

- bug about removing duplicate error messages
- made generating new keys more efficient
- made the top level an object in the same manner as all children so less checks need to be made and things flow more smoothly