refactor workspace script