Rewrote the script.

I didn't like the way original code was written. Hence, I rewrote the
script with lessons learnt over the time, and have tried to incoporate
as many good principles as possible. It's more unified and bit modular
than before, file names are removed to stop gists from getting
corrupted*. The README is updated to reflect the changes.

* Special characters or blanks in file names were causing the gist to
  be flagged as corrupted, which was then reported to GitHub by me.

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>