working at the core

the logic is fixed, now I just have to make it look good
outfile removed

un-needed command
commenting
added space where needed

and the final output, which needs to be tuned