For search input

much cleaner search input and modified some lines for optimization.