Generalization of code

Generalization of code