added callback argument to document function
reduced code size and greatly improved simplicity
further changes and refinement
fingers-crossed: final refinements and tweaks
Merge pull request #167 from neocotic/async-support

Callback
cleaned merge of pull request #167