improve/consolidate file finding code