add docs and minor fixes