starting to convert reachfinder from script to functions