Refactor the fabric script