Added support for generic types
Made the output file be a parameter