Create docs and fix some bugs