refactoring oz scripts