Day-4: Duplicated code reducing