Made code dry