Refactor build and documentation scripts.