working code and adding input file