Finish search function and route