Fixed all the logic for all search