first working version without search history