improve documentation for writing extensions, also add helper methods.