Most of logic worked out. Need to add appropriate argument handling and output file creation.