rewrote script

was able to reduce run time from ~6 minutes down to 5ish seconds