First refactor of the search navigator JS