Patch 1

NB: This pull request is not intended to be merged, rather is a proposal for discussion.

I believe the code is not correct. Ignore if I'm wrong. Else please update the script.