taking fetching of documentation out of global scope

delegating handling of promises to callers
updating doc blocks
refactoring places where globals where used

issue #38