Fix documentation script and other cleanup