stripped out redundancies

Stripped out some redundant code.  Moved the OS test to the top of the
script