Refactor fabric script