Refactores and Creates the preview search