move utility functions out of the class, ensure argparse values are used in loc_analyze