Refactoring script and re-adding LibreOffice support