Refactor documentation script