Eliminate duplicated code.