add docs and refactor jQuery extension