move search out into it's own file; minor refactor of some search logic.
delay scanning until main scope runs.