Using directives and generic code

Using directives and generic code