(untested) fully implement searching