Remove unnecessarily duplicated code