Refactory: removing duplication