fighting duplicated code