fixed exception handling. changed Popen cmds.
Changed all Popen commands to have shell=False and be lists.