attempt to make this work better...I need to pick up python and replace this atrocious script sometime