Functioning version of ARF script. Still haven't verified logic. Runs slowly so parameters need changing.