Added support for populate on existing documents. Added support for Apply on documents. Added hooks some more hooks. Refactored some code.. renamed variables to make more sense.
Fixed typos