Script clean up and restructure.
Ad little more clean up and typos.
Add support for pid file test.