writing doc
refactor doc generation