replace duplicate code with class dec's