Some code cleanup. Note at this point this file has no effect on the working of the script.
Polish minor code and update the documentation.