finalize search method