add docs, and some modifications