refactory search box