refactored script layout