Refactor search form helper