Restructure and fully document the script.

Also removed authorship credit for Cidiomar -- though his script was an influence, the implementation is completely different.
Update README.md.