typo
main method added
dynamic file name assignment