Refactor search model